<?php
/**
 * Controller of all actions related to manipulating bed used by patients

 * @package core.controllers
 * @author ppdong
 * @version $Id$
 * @copyright 2009 LHV Company
 *
 */
class C_TicketBed extends Controller {
    public function __construct($template_mod = "general"){
        parent::__construct();
        $this->_db = $GLOBALS['frame']['adodb']['db'];
        if (Celini::getCurrentController() == 'TicketBed') {
            $menu =& Menu::getInstance();
            $menu->currentSection = 'patient';
        }
        $this->template_mod = $template_mod;
        $this->view->path = 'ticket_bed';
    }

    /**
     * View beds used to cure a patient
     *
     * @param int $patientId Patient Id
     * @return html Table of used beds
     */
    public function actionViewPatientBed($patientId='') {
        if (isset($_GET['patientId'])) {
            $patientId =   $_GET['patientId'];
        }
        $bedList  =   ORDataObject::factory('PatientBed')->getBedByPatient($patientId);
        $this->assign('bedList', $bedList);
        $this->assign('index', 1);

        return $this->view->render('patient_bed_list.html');
    }
}
?>